<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'homeUrl' => '/',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'enableCsrfCookie' => false,
            'baseUrl' => '',
        ],
        'user' => [
            'identityClass' => 'frontend\models\User',
            'enableAutoLogin' => false,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the frontend
            'name' => 'carmv-frontend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],

        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '.html',
            'rules' => [
                "<controller:\w+>-<action:\w+>-<id:\d+>"=>"site/<action>",
            ],
        ],
//        'urlManager' => [
//            'enablePrettyUrl' => true,
//            'showScriptName' => false,
//            'enableStrictParsing' => true,
//            'suffix' => '.html',
//            'rules' => [
//                "/"=>"/site/index",
//                "/detail-<id:\d+>"=>"/site/detail",
//                "/article-<id:\d+>"=>"/site/article",
//                "/news-page-<page:\d+>"=>"/site/news",
//                "/ajax-getnews-page-<page:\d+>"=>"site/getnews",
//                "/ajax-getmore-<id:\d+>"=>"site/getmore",
//                "<action:\w+>"=>"site/<action>",
//                '<controller:\w+>-<action:\w+>-<id:\d+>' => 'site/<action>',
//                '<action:\w+>-<id:\d+>' => 'site/<action>',
//            ],
//        ],
//        'urlManager' => [
//            'enablePrettyUrl' => true,
//            'showScriptName' => false,
//            'enableStrictParsing' => true,
//            'suffix' => '.html',
//            'rules' => [
//                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
//                '<controller:\w+>/<action:\w+>/page/<page:\d+>' => '<controller>/<action>',
//                "<controller:\w+>/<action:\w+>"=>"<controller>/<action>",
//                "/site"=>"index",
//            ],
//        ],

    ],
    'params' => $params,
];
